Skip to content

FINERACT-405: Standardize mobile number validation across Client and Staff#5964

Open
anubhavio wants to merge 1 commit into
apache:developfrom
anubhavio:FINERACT-405-phone-validation-centralization
Open

FINERACT-405: Standardize mobile number validation across Client and Staff#5964
anubhavio wants to merge 1 commit into
apache:developfrom
anubhavio:FINERACT-405-phone-validation-centralization

Conversation

@anubhavio

@anubhavio anubhavio commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

This PR replaces the hardcoded mobile number validation regex with a configurable property-based validation approach.

Changes

-Added phone validation configuration under FineractProperties
-Introduced PhoneNumberValidationService to provide a shared validation rule
-Added custom @ValidPhoneNumber constraint and PhoneNumberValidator
-Updated StaffCreateRequest and StaffUpdateRequest to use the new validator
-Updated ClientDataValidator to use the same configurable validation rule
-Removed the hardcoded phone number regex constant
-Added/updated tests for client mobile number validation

@anubhavio anubhavio force-pushed the FINERACT-405-phone-validation-centralization branch from abdd8a2 to 3614282 Compare June 9, 2026 13:06

public class PhoneNumberConstants {

public static final String MOBILE_NUMBER_REGEX =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be configurable in a property, not fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IOhacker Thanks for the feedback. I investigated the existing validation and configuration patterns in Fineract. To make the regex configurable, I plan to move it into FineractProperties and replace the Staff @pattern validation with a custom validator backed by a shared PhoneNumberValidationService, so both Client and Staff validations use the same configurable rule.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anubhavio that is the best approach to use the same configurable rule.

@anubhavio anubhavio marked this pull request as draft June 11, 2026 12:56
Move phone number validation from a hardcoded regex constant to a
configurable property in FineractProperties.

Introduce a shared PhoneNumberValidationService and custom
@ValidPhoneNumber constraint so both client and staff validations
use the same configurable rule.

FINERACT-405: Centralize mobile number validation regex

FINERACT-405: Add missing ASF license header

WIP: save phone validation changes
@anubhavio anubhavio force-pushed the FINERACT-405-phone-validation-centralization branch from 3614282 to be97cdc Compare June 12, 2026 06:50
@anubhavio anubhavio changed the title FINERACT-405: Centralize mobile number validation regex FINERACT-405: Standardize mobile number validation across Client and Staff Jun 12, 2026
@anubhavio anubhavio marked this pull request as ready for review June 12, 2026 07:01
@anubhavio anubhavio requested a review from IOhacker June 12, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants